-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Reintroduce reflective REPL pprint call. #24353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
Looks good to me, need this to merge first so I can rebase #24298 on top |
|
@bishabosha how are you testing this? |
Scala CLI v1.10.0 handles the new REPL artifact. |
|
I test by publishing the binary locally with java -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.0-RC1-bin-SNAPSHOT) dotty.tools.repl.Main -cp $(cs fetch -p org.scala-lang:scala3-repl_3:3.8.0-RC1-bin-SNAPSHOT)although @hamzaremmal is working on either an alternative or replacement PR that should hide pprint from visible class path I think |
|
@Gedochao I'm getting an error running |
|
same failure happens on d47c0c6 as well, so even a clean |
I've been talking with Jamie about this PR offline and it is just lacking a comment that explains how all of this works. |
|
@bishabosha I'm getting some errors trying the command you gave. Did you have to run anything else to make it work? |
|
Turns out I needed |
|
I also heard that apparently you should use |
5984686 to
6956183
Compare
The class name changed, but the reflective call is still necessary for deeply nested objects to be formatted correctly. Includes a comment describing why the reflection is needed.
6956183 to
23b7ce1
Compare
|
@hamzaremmal I have pushed a comment explaining the situation with class loaders why reflection is necessary |
|
There is still potentially an alternative to avoid reflection but would require delegating all the classes pprint cases about to the root jvm classloader, (while hiding the rest of the classpath) and not instrumenting those ones also. Could be considered more complex then using reflection |
|
@hamzaremmal I noticed you removed the shading from fansi/pprint. Was that intentional? Without shading it opens up two potential conflicts:
If we don't want to shade them, we would need to provide classloader isolation for both of these scenarios, e.g. the REPL provides an artifact that loads its classes from a jar embedded as a resource file, and then compiles snippets without those classes included |
The class name changed, but the reflective call is still necessary for deeply nested objects to be formatted correctly.
@tgodzik @Gedochao for 3.8 backport recommendation
./cc @lihaoyi